package entity;


public class Move extends Thread {
	
	private Entity entity;
	
	private int currentPosition;
	
	private int futurePosition;
	
	public Move(Entity entity, int curPos, int futPos) {
		this.entity = entity;
		currentPosition = curPos;
		futurePosition = futPos;
	}
	
	@Override
	public void run() {
		while (currentPosition != futurePosition) {
			currentPosition += (currentPosition < futurePosition) ? 1 : -1;
			entity.updatePosition(currentPosition);
			try {
				Thread.sleep(10);
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}
	
}